package com.zhz.common.tool.jwt.autoconfig;

import com.zhz.common.tool.jwt.properties.JwtProperties;
import com.zhz.common.tool.jwt.service.JwtService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author zhouhengzhe
 * @date 2023/5/22
 */
@Slf4j
@Configuration
@ConditionalOnProperty(prefix = "ihrm.jwt", name = {"key", "ttl", }, matchIfMissing = false)
@EnableConfigurationProperties(JwtProperties.class)
public class JwtAuConfiguration {

    @Bean
    public JwtService jwtService(JwtProperties jwtProperties) {
        return new JwtService(jwtProperties);
    }

    //@Bean
    //public JwtInterceptor jwtInterceptor(JwtService jwtService){
    //    return new JwtInterceptor(jwtService);
    //}
}
